<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>绘制-直线-stroke-lincap</title>
    <style>
      body,
      ul {
        margin: 0;
        padding: 0;
      }

      body {
        background-image: url(../../images/grid.png);
      }
      svg {
        background-color: rgba(255, 0, 0, 0.1);
      }
    </style>
  </head>
  <body>
    <svg width="400" height="300" xmlns="http://www.w3.org/2000/svg">
      <!-- 
        stroke-linecap: 线帽，表示线段两端的形状，可选值：
          butt: 默认值，线段两端为平直的，没有线帽
          round: 线段两端为圆形的，线帽为圆形
          square: 线段两端为方形的，线帽为方形
      -->
      <line
        x1="10"
        y1="10"
        x2="100"
        y2="100"
        stroke="red"
        stroke-width="10"
        stroke-linecap="round"
      />
      <line
        x1="110"
        y1="10"
        x2="200"
        y2="100"
        stroke="red"
        stroke-width="10"
        stroke-linecap="square"
      />
      <line
        x1="210"
        y1="10"
        x2="300"
        y2="100"
        stroke="red"
        stroke-width="10"
        stroke-linecap="butt"
      />
    </svg>
  </body>
</html>
